%
crlf=CHR(13)+CHR(10)
SET CENTURY ON
m_transid=orequest.form('thetransid')
if isnull(m_transid)
m_transid=orequest.querystring('t')
endif
theuser=orequest.querystring('user')
pagetype=upper(orequest.querystring('pw'))
foraccount=upper(NVL(orequest.querystring('ac'),'NOTHING'))
*Pos Printer: 3 1/8" x 230' (approximately 80mm x 70m)
*Format Width x Height (in mm) Width x Height (in inches)
*A4 210 x 297 8.3 x 11.7
*A5 148 x 210 5.8 x 8.3
*A6 105 x 148 4.1 x 5.8
*A7 74 x 105 2.9 x 4.1
*
*
*
*
tpagewidth='210mm'
do CASE
case pagetype=[LET]
tpagewidth='210mm'
case pagetype=[A4]
tpagewidth='210mm'
case pagetype=[A5]
tpagewidth='148mm'
case pagetype=[A6]
tpagewidth='105mm'
case pagetype=[POS]
tpagewidth='80mm'
endcase
if isnull(m_transid)
tsql=[select top 1 x.*,IIF(VAL(x.transid)=0,VAL(SUBSTR(x.transid,2)),VAL(x.transid)) AS VTR, ]
tsql=tsql+[ padl(allt(x.transid),9) as ptransid, y.name as acname, z.name as depositname ]
tsql=tsql+[ from ("]+dbclocation+'transfer.dbf'+[") x left join ("]+dbclocation+'accounts.dbf'+[") y ]
tsql=tsql+[ on (x.creditor=y.accountid) left join ("]+dbclocation+'accounts.dbf'+[") z ]
tsql=tsql+[ on (x.debitor=z.accountid) ]
tsql=tsql+[ order by vtr desc, ptransid desc into cursor xtmpcur]
else
tsql=[select top 1 x.*,IIF(VAL(x.transid)=0,VAL(SUBSTR(x.transid,2)),VAL(x.transid)) AS VTR, ]
tsql=tsql+[ padl(allt(x.transid),9) as ptransid, y.name as acname, z.name as depositname ]
tsql=tsql+[ from ("]+dbclocation+'transfer.dbf'+[") x left join ("]+dbclocation+'accounts.dbf'+[") y ]
tsql=tsql+[ on (x.creditor=y.accountid) left join ("]+dbclocation+'accounts.dbf'+[") z ]
tsql=tsql+[ on (x.debitor=z.accountid) order by vtr desc ]
tsql=tsql+[ where allt(transid)==']+allt(m_transid)+[' into cursor xtmpcur]
endif
&tsql
SCATTER NAME SearchResults
thedate=SearchResults.date
if TYPE('SearchResults.fbrinv')='C' and not ALLTRIM(SearchResults.fbrinv)=='0' and not EMPTY(SearchResults.fbrinv)
fbrnumberreceived=allt(searchresults.fbrinv)
else
fbrnumberreceived=[]
endif
if empty(date)
thedatestring=date() &&transform(date())
else
thedatestring=date &&transform(dtoc(date))
endif
hasopening=.f.
***
textofbalance=[]
strofbalance=[]
if BETWEEN(val(left(searchresults.CREDITOR,2)),1,8) and left(searchresults.CREDITOR,3)<>[019] and (foraccount="WRAPPER" OR foraccount="CREDITOR")
select sum(debit) as debits, SUM(credit) as credits from (dbclocation+[acctran]) where ;
accountid=searchresults.CREDITOR and date=Thedate INTO CURSOR closing
select sum(debit-credit) as dayopening from (dbclocation+[acctran]) where ;
accountid=searchresults.CREDITOR and date>Thedate INTO CURSOR opening
select sum(debit-credit) as allclosing from (dbclocation+[acctran]) where ;
accountid=searchresults.CREDITOR INTO CURSOR allclosing
if nvl(allclosing.allclosing,0)<>0 or nvl(opening.dayopening,0)+closing.debits+closing.credits<>0
hasopening=.t.
textofbalance=textofbalance+[
]
strofbalance=strofbalance+searchresults.acname+crlf
strofbalance=strofbalance+[Opening: ]+allt(transform(nvl(opening.dayopening,0),'99999999999.99'))+crlf
strofbalance=strofbalance+[Add Debits: ]+allt(transform(closing.debits,'99999999999.99'))+crlf
strofbalance=strofbalance+[Less Credits: ]+allt(transform(closing.debits,'99999999999.99'))+crlf
if nvl(opening.dayopening,0)+closing.debits+closing.credits<>0
strofbalance=strofbalance+[Balance on ]+transform(thedatestring)+[: ]+;
allt(transform(nvl(opening.dayopening,0)+closing.debits+closing.credits,'99999999999.99'))+crlf
endif
strofbalance=strofbalance+[OVerall Closing: ]+allt(transform(nvl(allclosing.allclosing,0.00),'99999999999.99'))+crlf
endif
endif
ENDIF
if BETWEEN(val(left(searchresults.debitor,2)),1,8) and left(searchresults.debitor,3)<>[019] and (foraccount="WRAPPER" OR foraccount="DEBITOR")
select sum(debit) as debits, SUM(credit) as credits from (dbclocation+[acctran]) where ;
accountid=searchresults.debitor and date=Thedate INTO CURSOR cclosing
select sum(debit-credit) as dayopening from (dbclocation+[acctran]) where ;
accountid=searchresults.debitor and date>Thedate INTO CURSOR copening
select sum(debit-credit) as allclosing from (dbclocation+[acctran]) where ;
accountid=searchresults.debitor INTO CURSOR callclosing
if nvl(callclosing.allclosing,0)<>0 or nvl(copening.dayopening,0)+cclosing.debits+cclosing.credits<>0
hasopening=.t.
textofbalance=textofbalance+[